<!DOCTYPE html>
<html>

<head lang="en">
    <title></title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategy.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>

    <script>
        $(function () {
            //借款
            $('#inpBtn').click(function () {
                $('#inputModal').modal('show');
            })
            $('.submitBtn').click(function () {
                var name = $('#name').val();
                var age = $('#age').val();
                var address = $('#address').val();
                var cardNum = $('#cardNum').val();
                var phoneNum = $('#phoneNum').val();
                var job = $('#job').val();
                var income = $('#income').val();
                var borrowMoney = $('#borrowMoney').val();
                var json = {
                    name:name,
                    age:age,
                    address:address,
                    cardNum:cardNum,
                    phoneNum:phoneNum,
                    job:job,
                    income:income,
                    borrowMoney:borrowMoney
                }
                $.post(baseUrl+"/finances",json,function (data) {
                    console.log(data);
                });
            });

            //还款
            $('#outBtn').click(function () {
                $('#outModal').modal('show')
            })

            $('.submit-Btn').click(function () {
                var balance = $('#balance').val();
                $.ajax({
                    url: baseUrl + "/finances/" + 1,
                    method: 'put',
                    data: {money: balance},
                    success:function (data) {
                        console.log(data);
                    }
                });
            })

        })

    </script>
</head>

<body>
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <form class="form-horizontal" action="#" method="post" id="editForm">
                    <input type="hidden" name="id">
                    <input type="hidden" name="user.id">
                    <div class="form-group" >
                        <label class="col-sm-4 control-label">姓名：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="name" id="name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">年龄：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="age" id="age">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">联系方式：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="phoneNum" id="phoneNum">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">年收入：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="income">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">职务：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="job" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">身份证：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="cardNum" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">家庭地址：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="address">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-4 control-label">借款金额：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" id="borrowMoney" >
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    <span class="glyphicon glyphicon-off"></span> 关闭
                </button>
                <button type="button" class="btn btn-primary submitBtn">
                    <span class="glyphicon glyphicon-saved"></span> 提交
                </button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="outModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <form class="form-horizontal" action="#" method="post" id="outForm">
                    <input type="hidden" _mothod="put">
                    <input type="hidden" name="id">
                    <input type="hidden" name="user.id">
                    <div class="form-group" >
                        <label class="col-sm-4 control-label">还款金额：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="balance" id="balance">
                        </div>
                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                    <span class="glyphicon glyphicon-off"></span> 关闭
                </button>
                <button type="button" class="btn btn-primary submit-Btn">
                    <span class="glyphicon glyphicon-saved"></span> 提交
                </button>
            </div>
        </div>
    </div>
</div>
<button id="inpBtn">点击借款</button>
<button id="outBtn">点击还款</button>
</body>
</html>